home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / lfs / lfsDescMap.h < prev    next >
C/C++ Source or Header  |  1990-10-19  |  3KB  |  103 lines

  1. /*
  2.  * lfsDescMap.h --
  3.  *
  4.  *    Declarations defining the disk resident format of the LFS 
  5.  *    descriptor map. The main purpose of the descriptor map is 
  6.  *    to provide a fast lookup of a file descriptor address given
  7.  *    the file descriptor number.
  8.  *
  9.  * Copyright 1989 Regents of the University of California
  10.  * Permission to use, copy, modify, and distribute this
  11.  * software and its documentation for any purpose and without
  12.  * fee is hereby granted, provided that the above copyright
  13.  * notice appear in all copies.  The University of California
  14.  * makes no representations about the suitability of this
  15.  * software for any purpose.  It is provided "as is" without
  16.  * express or implied warranty.
  17.  *
  18.  * $Header: /sprite/src/kernel/lfs/RCS/lfsDescMap.h,v 1.5 90/10/19 17:22:40 mendel Exp $ SPRITE (Berkeley)
  19.  */
  20.  
  21. #ifndef _LFSDESCMAP
  22. #define _LFSDESCMAP
  23.  
  24. #ifdef KERNEL
  25. #include <lfsStableMem.h>
  26. #else
  27. #include <kernel/lfsStableMem.h>
  28. #endif
  29.  
  30. /*
  31.  * The descriptor map layout on disk is described by the following 
  32.  * super block resident structure. 
  33.  * It must be LFS_DESC_MAP_PARAM_SIZE (currently 64 bytes) in size. 
  34.  */
  35. #define    LFS_DESC_MAP_PARAM_SIZE    64
  36.  
  37. typedef struct LfsDescMapParams {
  38.     unsigned int version;      /* Version number describing the format of
  39.                  * this structure and the descriptor map. */
  40.     int     maxDesc;    /* The maximum size in descriptor map in 
  41.                  * descriptor. */
  42.     char     padding[LFS_DESC_MAP_PARAM_SIZE - sizeof(LfsStableMemParams)-8];    
  43.                 /* Enought padding to make this structure 32
  44.                  * bytes. */
  45.     LfsStableMemParams     stableMem; /* Index parameters. */
  46.  
  47. } LfsDescMapParams;
  48.  
  49. #define LFS_DESC_MAP_VERSION 1
  50.  
  51. /*
  52.  * Following this structure describes the disk format of LFS descriptor map
  53.  * checkpoint.
  54.  * The total size
  55.  * of the checkpoint should be 
  56.  * sizeof(LfsDescMapCheckPointHdr) + 
  57.  *         Sizeof(LfsStableMemCheckPoint)
  58.  * The maximum size should be:
  59.  *
  60.  */
  61.  
  62. #define    LFS_DESC_MAP_MIN_BLOCKS    1
  63.  
  64. typedef struct LfsDescMapCheckPoint {
  65.     int numAllocDesc;    /* The number of allocated descriptors at this 
  66.              * checkpoint.  */
  67. } LfsDescMapCheckPoint;
  68.  
  69. /*
  70.  * For each allocate file number in a LFS, the descriptor map keeps an 
  71.  * entry of type LfsDescMapEntry. LfsDescMapEntry are packed into blocks
  72.  * with 
  73.  */
  74. typedef struct LfsDescMapEntry {
  75.     LfsDiskAddr  blockAddress;        /* The disk block address of the most
  76.                      * current version of the descriptor. */
  77.     unsigned short truncVersion;    /* A version number increamented each 
  78.                      * time a descriptor is truncated to 
  79.                      * length zero.  See the cleaning code
  80.                      * for its use. */
  81.     unsigned short  flags;          /* See flags definition below. */
  82.     int  accessTime;              /* The access time of the file as 
  83.                      * return by the stat() system call. */
  84. } LfsDescMapEntry;
  85.  
  86. /*
  87.  * The following definitions define the uses of the descriptor flags field of
  88.  * the LfsDescMapEntry structure.
  89.  *    
  90.  * LFS_DESC_MAP_ALLOCED         - The descriptor map entry has been alloced
  91.  *                  by the file system.
  92.  * LFS_DESC_MAP_UNLINKED    - The file represented by this descMap entry
  93.  *                  has no references to it from directories 
  94.  *                  but has not been freed. This can happen when
  95.  *                  a file is unlinked while open.  
  96.  */
  97.  
  98. #define    LFS_DESC_MAP_ALLOCED    0x0001
  99. #define    LFS_DESC_MAP_UNLINKED    0x0002
  100.  
  101.  
  102. #endif /* _LFSDESCMAP */
  103.